package com.xiaoniu.lib_keleim.utils;


import com.xiaoniu.lib_keleim.pojo.vos.BaseMessage;

import java.util.ArrayList;

public class MessageFilterUtil {

    static ArrayList<String> messagePool = new ArrayList<String>(400);
    static ArrayList<String> messageAdapterPool = new ArrayList<String>(400);

    public static boolean filter(BaseMessage message) {
        if (message==null) {
            return true;
        }
        if (messagePool.contains(message.messageId+"")) {
            return true;
        }
        messagePool.add(message.messageId+"");
        return false;
    }

    public static boolean filterAdapter(BaseMessage message) {
        if (message==null) {
            return true;
        }
        if (messageAdapterPool.contains(message.messageId+"")) {
            return true;
        }
        messageAdapterPool.add(message.messageId+"");
        return false;
    }

    public static void clear() {
        messagePool.clear();
        messageAdapterPool.clear();
    }
}
